package cn.wolfcode.luowowo.acticle.service.impl;

import cn.wolfcode.luowowo.acticle.domain.Planeticket;
import cn.wolfcode.luowowo.acticle.mapper.PlaneticketMapper;
import cn.wolfcode.luowowo.acticle.query.PlaneticketQuery;
import cn.wolfcode.luowowo.acticle.service.IPlaneticketService;
import cn.wolfcode.luowowo.common.exception.DisplayableException;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class PlaneticketServiceImpl implements IPlaneticketService {

    @Autowired
    private PlaneticketMapper planeticketMapper;

    public PageInfo query(PlaneticketQuery qo) throws DisplayableException {
        qo.setPageSize(5);
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize(), qo.getOrderBy());
        return new PageInfo(planeticketMapper.selectForList(qo));
    }

    public Planeticket getParameterById(Long id) {
        Planeticket planeticket = planeticketMapper.selectByPrimaryKey(id);
        return planeticket;
    }
}
